package ar.edu.uba.fi.jmit.aspecter.testUtils;

import java.util.LinkedList;
import java.util.List;

import javassist.CtClass;
import ar.edu.uba.fi.jmit.aspecter.core.WeavingInstrumentor;
import ar.edu.uba.fi.jmit.aspecter.core.exception.AspecterException;
import ar.edu.uba.fi.jmit.aspecter.core.injector.Injector;
import ar.edu.uba.fi.jmit.aspecter.core.interceptor.Interceptor;

public class SpyInstrumentor implements WeavingInstrumentor{
	
	private List<CtClass> alteredClasses;
	
	public SpyInstrumentor() {
		super();
		alteredClasses = new LinkedList<CtClass>();
	}

	@Override
	public void addInjector(String className, Injector injector) {
		
	}

	@Override
	public void addInterceptor(Interceptor accesInterceptor) {
		
	}

	@Override
	public void alter(CtClass ctClass) throws AspecterException {
		alteredClasses.add(ctClass);
	}
	
	public boolean alteredClass(String className) {
		for(CtClass ctClass:alteredClasses) {
			if(className.equals(ctClass.getName())) {
				return true;
			}
		}
		return false;
	}

	@Override
	public String getMonitorName() {
		return null;
	}
	
}
